<?php

class RegStudentController extends Controller
{
	public function actionListStudent()
	{
		$this->layout='//layouts/blank';
		$model=new RegStudent('search');
		$model->unsetAttributes();  // clear any default values
		if(isset($_GET['RegStudent']))
			$model->attributes=$_GET['RegStudent'];
		$model->section=$_GET['RegStudent']['section'];
		$this->render('listStudent',array(
				'model'=>$model,
		));
	}
	public function actionGetStudent($id)
	{
		$student=RegStudent::model()->findByPk($id);
		$data=array(
					'studentID'=>$student->student_id,
					'name'=>$student->student_name." ".$student->student_surname,
					'major'=>$student->major,
					'department'=>$student->department,
					'credit'=>$student->sum_credit,
					'gradAVG'=>$student->gpa,
			);
		echo json_encode($data);
	}
	// Uncomment the following methods and override them if needed
	/*
	public function filters()
	{
		// return the filter configuration for this controller, e.g.:
		return array(
			'inlineFilterName',
			array(
				'class'=>'path.to.FilterClass',
				'propertyName'=>'propertyValue',
			),
		);
	}

	public function actions()
	{
		// return external action classes, e.g.:
		return array(
			'action1'=>'path.to.ActionClass',
			'action2'=>array(
				'class'=>'path.to.AnotherActionClass',
				'propertyName'=>'propertyValue',
			),
		);
	}
	*/
}